﻿using Microsoft.AspNet.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Week6Music_API_and_Angular_.Adapter.Adapter;
using Week6Music_API_and_Angular_.Adapter.Interfaces;
using Week6Music_API_and_Angular_.Data.Model;
using Week6Music_API_and_Angular_.Models;

namespace Week6Music_API_and_Angular_.Controllers
{
    public class apiArtistController : ApiController
    {
        private IArtistAdapter _adapter;

        public apiArtistController()
        {
            _adapter = new ArtistAdapter();
        }

        public apiArtistController(IArtistAdapter a)
        {
            _adapter = a;
        }

        public IHttpActionResult Get()
        {
            string userId = User.Identity.GetUserId();
            List<ArtistVM> artists = _adapter.GetAllArtists();
            return Ok(artists); //returns 200
            //return BadRequest(); //returns 400
            //return NotFound(); //returns 404
            //return InternalServerError(); //returns 500
        }

        public IHttpActionResult Get(int id)
        {
            string userId = User.Identity.GetUserId();
            ArtistDetailsVM artistDetails = _adapter.GetArtistDetails(id);
            return Ok(artistDetails);
        }

        public IHttpActionResult Post()
        {
            return Ok();
        }
    }
}